<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE HTML>
<html>
<head>
    <title>首页</title>
    <script src="js/jquery.js" type="text/javascript"></script>
</head>

<script type="text/javascript">

    function login() {
        var name = $("#name2").val();
        var password = $("#password2").val();

        var User = {
            name:name,
            password:password
        }
        var UserJson = JSON.stringify(User);

        $.ajax({
            type:"post",
            url:"user/login2",
            contentType: "application/json; charset=utf-8",
            data:{
                "User":UserJson
            },
            dataType:"text",
            success:function (result){
                
            },
            error:function () {

            }
        })

    }

</script>

<body>
<h3>
    <a href="user/selectOne?id=1">点击进入列表页</a>
</h3>

<form action="user/login" method="get">
    <div>
        <div>
            <input id="name" name="name" placeholder="请输入用户名">
        </div>
        <div>
            <input type="password" name="password" id="password" placeholder="请输入密码">
        </div>
        <div>
            <button type="submit">登录</button>
        </div>
    </div>
</form>

<div>
    <div>
        <input id="name2" name="name2" placeholder="请输入用户名">
    </div>
    <div>
        <input type="password" name="password2" id="password2" placeholder="请输入密码">
    </div>
    <div>
        <button type="button" onclick="login()">登录</button>
    </div>
</div>
</body>
</html>
